/**
 * Resourece
 * @ 第一屏 杂项
 */
import { Base } from "@/pixi/base";
class Resourece extends Base {
  Resourece: any[];
  getSprites: any;
  isRendering: boolean;
  position: object | string;
  anchor: object | string;
  constructor() {
    super();
    this.Resourece = [];
    this.getSprites = {};
    this.load();
    this.position = {x: 2660, y: 0};
    // this.position = {x: -800, y: 0};
    this.anchor = "center";
    this.isRendering = true
  }
  load() {
    // 遍历资源
    const ResoureceNameList: string[] = [
      "p3-2",
      "p3-1",
      "p3-3",
      "p3-childbirth",
    ];
    for (let i = 0; i <= ResoureceNameList.length - 1; i++) {
      this.Resourece.push({
        name: `${ResoureceNameList[i].replace("-", "")}`,
        url: require(`@/${this.baseUrl}/images/${ResoureceNameList[i]}.png`),
      });
    }
    // 设置精灵
    for (let i = 0; i <= ResoureceNameList.length - 1; i++) {
      console.log(ResoureceNameList[i].replace("-", ""));
      this.getSprites[ResoureceNameList[i].replace("-", "")] = {
        key: `${ResoureceNameList[i].replace("-", "")}`,
        size: {mode:'widthFit', width: 0.5 },
        position: "center",
        anchor: "center",
        alpha: '1',
      };
    }
    this.getSprites.p31 = {
      key: `p31`,
      size: { mode: "widthFit", width: 1.9 },
      position: { 
        x:0.8, y: 0.5
      },
      anchor: "center",
      alpha: '1',
    };
    this.getSprites.p32 = {
      key: `p31`,
      size: { mode: "widthFit", width: .5 },
      position: { 
        x:0.9, y: .25
      },
      anchor: "center",
      alpha: '1',
    };
    this.getSprites.p33 = {
      key: `p33`,
      size: { mode: "widthFit", width: 1.5 },
      position: {x: 1.6, y: .5},
      anchor: "center",
      alpha: '1',
    };
    this.getSprites.p3childbirth = {
      key: `p3childbirth`,
      size: { mode: "widthFit", width: .8 },
      position: {x: 2.8, y: .6},
      anchor: "center",
      alpha: '1',
    };
  }
}
export default new Resourece();
